import { Linking, NativeModules } from "react-native";
const RNExitApp = NativeModules.RNExitApp;
export default (url, isFouce = false)=> {
  let toUrl = url; //itms://itunes.apple.com 这种直接跳appStore的。
  if(url.endsWith('.plist')){
    toUrl = 'itms-services:///?action=download-manifest&url=' + url
  }
	Linking.canOpenURL(toUrl).then(supported => {
      if (supported) {
          Linking.openURL(toUrl).then(isOpen => {
						RNExitApp.exit();
          }).catch(err => console.log('An error occurred', err));
      }
  })
	.catch(err => console.log('An error occurred', err));
}
